package com.mojo.tree;

/**
 * 代码实现链式存储二叉树
 *
 * @author <a href="mailto:sjj@jianzhimao.com">mojo</a>
 * copyright (C), 2013-2022, 广州九尾信息科技有限公司
 * @date 2022/8/29 10:45
 */
public class ChainBinaryTree {
    //左子节点
    ChainBinaryTree lChild;
    //有子节点
    ChainBinaryTree rChild;
    //数据域
    Object data;
    //父节点,方便子节点查询父节点
    ChainBinaryTree parent;

    public ChainBinaryTree getlChild() {
        return lChild;
    }

    public void setlChild(ChainBinaryTree lChild) {
        this.lChild = lChild;
    }

    public ChainBinaryTree getrChild() {
        return rChild;
    }

    public void setrChild(ChainBinaryTree rChild) {
        this.rChild = rChild;
    }

    public Object getData() {
        return data;
    }

    public void setData(Object data) {
        this.data = data;
    }

    public ChainBinaryTree getParent() {
        return parent;
    }

    public void setParent(ChainBinaryTree parent) {
        this.parent = parent;
    }

    public ChainBinaryTree(ChainBinaryTree lChild, ChainBinaryTree rChild, Object data) {
        this.lChild = lChild;
        this.rChild = rChild;
        this.data = data;
    }
}
